package org.convallaria.system.biz.entity.dto.sys;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * 用户更新DTO
 * 
 * @author convallaria
 * @since 1.0.0
 */
@Data
@Schema(description = "用户更新DTO")
public class UserUpdateDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    /**
     * 部门ID
     */
    @Schema(description = "部门ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "部门ID不能为空")
    private Long deptId;

    /**
     * 用户账号
     */
    @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin")
    @NotBlank(message = "用户账号不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9_]{3,20}$", message = "用户账号只能包含字母、数字、下划线，长度3-20位")
    private String userName;

    /**
     * 用户昵称
     */
    @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "管理员")
    @NotBlank(message = "用户昵称不能为空")
    private String nickName;

    /**
     * 真实姓名
     */
    @Schema(description = "真实姓名", example = "张三")
    private String realName;

    /**
     * 用户邮箱
     */
    @Schema(description = "用户邮箱", example = "admin@example.com")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 手机号码
     */
    @Schema(description = "手机号码", example = "13800138000")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
    private String phoneNumber;

    /**
     * 用户性别
     */
    @Schema(description = "用户性别", example = "0", allowableValues = {"0", "1", "2"})
    private String gender;

    /**
     * 出生日期
     */
    @Schema(description = "出生日期", example = "1990-01-01")
    private String birthday;

    /**
     * 头像地址
     */
    @Schema(description = "头像地址")
    private String avatar;

    /**
     * 帐号状态
     */
    @Schema(description = "帐号状态", example = "0", allowableValues = {"0", "1"})
    private String status;

    /**
     * 用户类型
     */
    @Schema(description = "用户类型", example = "00", allowableValues = {"00", "01", "02"})
    private String userType;

    /**
     * 岗位ID列表
     */
    @Schema(description = "岗位ID列表")
    private List<Long> postIds;

    /**
     * 角色ID列表
     */
    @Schema(description = "角色ID列表")
    private List<Long> roleIds;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     * 版本号（乐观锁）
     */
    @Schema(description = "版本号")
    private Long version;
}
